home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / Installer SDK 1.2.3 / Upgrader 1.2.3 & Engines / Upgrader 1.2.3 / Plug-in Examples / Common Files / MWCPlusExtensions / ExceptionPPC.h < prev    next >
Encoding:
Text File  |  1997-04-07  |  7.5 KB  |  192 lines  |  [TEXT/CWIE]

  1.  
  2. //
  3. //  ExceptionPPC.h    -    C++ Exception Table Format for CodeWarriorâ„¢ (PowerPC)
  4. //
  5. //  Copyright Â© 1995 metrowerks inc.  All rights reserved.
  6. //
  7. //
  8.  
  9. #ifndef __EXCEPTIONPPC_H__
  10. #define __EXCEPTIONPPC_H__
  11.  
  12. #pragma options align=mac68k
  13.  
  14.  
  15. //    Exception Table Actions
  16.  
  17. typedef unsigned char exaction_type;
  18.  
  19. #define EXACTION_ENDBIT                    0x80    //    action table end bit
  20. #define EXACTION_MASK                    0x7F    //    action mask
  21.  
  22. #define    EXACTION_ENDOFLIST                0
  23.  
  24. #define    EXACTION_BRANCH                    1
  25. typedef struct ex_branch {
  26.     exaction_type    action;                //    EXACTION_BRANCH
  27.     unsigned char    unused;                //    (reserved for future use)
  28.     unsigned short    target;                //    exception-table-relative offset of branch target
  29. } ex_branch;
  30.  
  31. #define EXACTION_DESTROYLOCAL            2
  32. typedef struct ex_destroylocal {
  33.     exaction_type    action;                //    EXACTION_DESTROYLOCAL
  34.     unsigned char    unused;                //    (reserved for future use)
  35.     short            local;                //    16-bit frame-relative offset to local variable
  36.     void*            dtor;                //    absolute pointer to TVector of destructor
  37. } ex_destroylocal;
  38.  
  39. #define EXACTION_DESTROYLOCALCOND        3
  40. typedef struct ex_destroylocalcond {
  41.     exaction_type    action;                //    EXACTION_DESTROYLOCALCOND
  42.     unsigned char    regcond        : 1,    //    1 -> condition flag is in a GPR
  43.                     unused        : 7;    //    (reserved for future use)
  44.     short            cond;                //    16-bit frame-relative offset or GPR# of condition flag
  45.     short            local;                //    16-bit frame-relative offset to local variable
  46.     void*            dtor;                //    absolute pointer to TVector of destructor
  47. } ex_destroylocalcond;
  48.  
  49. #define EXACTION_DESTROYLOCALPOINTER    4
  50. typedef struct ex_destroylocalpointer {
  51.     exaction_type    action;                //    EXACTION_DESTROYLOCALPOINTER
  52.     unsigned char    regpointer    : 1,    //    1 -> pointer is in a GPR
  53.                     unused        : 7;    //    (reserved for future use)
  54.     short            pointer;            //    16-bit frame-relative offset or GPR# of local pointer
  55.     void*            dtor;                //    absolute pointer to TVector of destructor
  56. } ex_destroylocalpointer;
  57.  
  58. #define EXACTION_DESTROYLOCALARRAY        5
  59. typedef struct ex_destroylocalarray {
  60.     exaction_type    action;                //    EXACTION_DESTROYLOCALARRAY
  61.     unsigned char    unused;                //    (reserved for future use)
  62.     short            localarray;            //    16-bit frame-relative offset to local array
  63.     unsigned short    elements;            //    number of array elements
  64.     unsigned short    element_size;        //    size of one array element
  65.     void*            dtor;                //    absolute pointer to TVector of destructor
  66. } ex_destroylocalarray;
  67.  
  68. #define EXACTION_DESTROYBASE            6
  69. #define EXACTION_DESTROYMEMBER            7
  70. typedef struct ex_destroymember {
  71.     exaction_type    action;                //    EXACTION_DESTROYMEMBER or EXACTION_DESTROYBASE
  72.     unsigned char    regpointer    : 1,    //    1 -> object pointer is in a GPR
  73.                     unused        : 7;    //    (reserved for future use)
  74.     short            objectptr;            //    16-bit frame-relative offset or GPR# of object pointer
  75.     long            offset;                //    offset of member in complete object
  76.     void*            dtor;                //    absolute pointer to TVector of destructor
  77. } ex_destroymember;
  78.  
  79. #define EXACTION_DESTROYMEMBERCOND        8
  80. typedef struct ex_destroymembercond {
  81.     exaction_type    action;                //    EXACTION_DESTROYMEMBERCOND
  82.     unsigned char    regcond        : 1,    //    1 -> condition flag is in a GPR
  83.                     regpointer    : 1,    //    1 -> object pointer is in a GPR
  84.                     unused        : 6;    //    (reserved for future use)
  85.     short            cond;                //    16-bit frame-relative offset or GPR# of condition flag
  86.     short            objectptr;            //    16-bit frame-relative offset or GPR# of object pointer
  87.     long            offset;                //    offset of member in complete object
  88.     void*            dtor;                //    absolute pointer to TVector of destructor
  89. } ex_destroymembercond;
  90.  
  91. #define EXACTION_DESTROYMEMBERARRAY        9
  92. typedef struct ex_destroymemberarray {
  93.     exaction_type    action;                //    EXACTION_DESTROYMEMBERARRAY
  94.     unsigned char    regpointer    : 1,    //    1 -> object pointer is in a GPR
  95.                     unused        : 7;    //    (reserved for future use)
  96.     short            objectptr;            //    16-bit frame-relative offset or GPR# of object pointer
  97.     long            offset;                //    offset of member in complete object
  98.     long            elements;            //    number of array elements
  99.     long            element_size;        //    size of one array element
  100.     void*            dtor;                //    absolute pointer to TVector of destructor
  101. } ex_destroymemberarray;
  102.  
  103. #define EXACTION_DELETEPOINTER            10
  104. typedef struct ex_deletepointer {
  105.     exaction_type    action;                //    EXACTION_DELETEPOINTER
  106.     unsigned char    regpointer    : 1,    //    1 -> object pointer is in a GPR
  107.                     unused        : 7;    //    (reserved for future use)
  108.     short            objectptr;            //    16-bit frame-relative offset or GPR# of object pointer
  109.     void*            deletefunc;            //    absolute pointer to TVector of deletefunc
  110. } ex_deletepointer;
  111.  
  112. #define EXACTION_DELETEPOINTERCOND        11
  113. typedef struct ex_deletepointercond {
  114.     exaction_type    action;                //    EXACTION_DELETEPOINTERCOND
  115.     unsigned char    regcond        : 1,    //    1 -> condition flag is in a GPR
  116.                     regpointer    : 1,    //    1 -> object pointer is in a GPR
  117.                     unused        : 6;    //    (reserved for future use)
  118.     short            cond;                //    16-bit frame-relative offset or GPR# of condition flag
  119.     short            objectptr;            //    16-bit frame-relative offset or GPR# of object pointer
  120.     void*            deletefunc;            //    absolute pointer to TVector of deletefunc
  121. } ex_deletepointercond;
  122.  
  123. #define EXACTION_CATCHBLOCK                12
  124. typedef struct ex_catchblock {
  125.     exaction_type    action;                //    EXACTION_CATCHBLOCK
  126.     unsigned char    unused;                //    (reserved for future use)
  127.     char*            catch_type;            //    absolute pointer to catch type info; 0 => catch(...)
  128.     unsigned short    catch_pcoffset;        //    16-bit function-relative offset to catch label
  129.     short            cinfo_ref;            //    16-bit frame-relative offset to local CatchInfo struct
  130. } ex_catchblock;
  131.  
  132. #define EXACTION_ACTIVECATCHBLOCK        13
  133. typedef struct ex_activecatchblock {
  134.     exaction_type    action;                //    EXACTION_ACTIVECATCHBLOCK
  135.     unsigned char    unused;                //    (reserved for future use)
  136.     short            cinfo_ref;            //    16-bit frame-relative offset to local CatchInfo struct
  137. } ex_activecatchblock;
  138.  
  139. #define EXACTION_TERMINATE                14
  140. typedef struct ex_terminate {
  141.     exaction_type    action;                //    EXACTION_TERMINATE
  142.     unsigned char    unused;                //    (reserved for future use)
  143. } ex_terminate;
  144.  
  145. #define EXACTION_SPECIFICATION            15
  146. typedef struct ex_specification {
  147.     exaction_type    action;                //    EXACTION_SPECIFICATION
  148.     unsigned char    unused;                //    (reserved for future use)
  149.     unsigned short    specs;                //    number of specializations (0-n)
  150.     long            pcoffset;            //    16-bit function-relative offset to catch label
  151.     long            cinfo_ref;            //    16-bit frame-relative offset to local CatchInfo struct
  152.     char            *spec[];            //    array of absolute pointers to catch type info
  153. }    ex_specification;
  154.  
  155.  
  156. //    Exception Table Ranges
  157.  
  158. typedef struct ExceptionRange {
  159.     unsigned short    start;                //    start of PC range where actions apply
  160.     unsigned short    end;                //    end of PC range where actions apply
  161.     unsigned short    action;                //    table-relative offset to actions for an
  162. } ExceptionRange;                        //    exception thrown in range start..end
  163.  
  164.  
  165. //    Exception Tables (per-function)
  166.  
  167. typedef struct ExceptionTable {
  168.     unsigned short    savedGPRs    : 5,    //    # of saved GPRs (rN-r31)
  169.                     savedFPRs    : 5,    //    # of saved FPRs (rN-r31)
  170.                     savedCR        : 1,    //    1 -> saved CR in frame    
  171.                     hasframeptr    : 1,    //    1 -> frame uses R31 as frame pointer
  172.                     reserved    : 4;    //    (reserved for future use)
  173.     ExceptionRange    ranges[];            //    table of PC ranges and their actions
  174. //    unsigned short    end = 0;            //    (marks end of range list)
  175. //    unsigned long    actions[];            //    arbitrary action data
  176. } ExceptionTable;
  177.  
  178.  
  179. //    Exception Table Indices (per-function)
  180.  
  181. typedef struct ExceptionTableIndex {
  182.     unsigned long    functionoffset;        //    code-relative address of function
  183.     unsigned long    directstore : 1,    //    1 -> 4 byte exception table is in 'exceptionoffset'
  184.                     functionsize : 31;    //    length of function
  185.     unsigned long    exceptionoffset;    //    data-relative address of exception table
  186. } ExceptionTableIndex;                    //    (or table itself if 'directstore' == 1)
  187.  
  188.  
  189. #pragma options align=reset
  190.  
  191. #endif
  192.